<template>
	<view class="padding-30">
		<choose-tabs IsFontView :list="tabsList" :checkIndex="tabIndex" @checkView="handleTabs" />
		<view class="margin-top50">
			<list-item :list="withdrawalList"></list-item>
		</view>
		<view v-if="withdrawalList&&withdrawalList.length<1" style="margin-top: 200rpx;">
			<u-empty color="#ffffff" icon-color="#ffffff" text="暂未收益" mode="list"></u-empty>
		</view>
	</view>
</template>

<script>
	import chooseTabs from "@/components/tabs/chooseTabs.vue"
	import listItem from "@/components/list/list-item.vue"
	export default {
		components: {
			chooseTabs,
			listItem
		},
		data() {
			return {
				tabIndex: 0,
				tabsList: [{
						name: '新春红包'
					},
					{
						name: '收益分红'
					},
					{
						name: '团队钱包'
					},
				],
				withdrawalList: [],
				elimit: 'spring'
			}
		},
		onShow() {
			this.getRecord()
		},
		methods: {
			getRecord() {
				this.$http.post(this.$api.getRecord,{type: this.elimit}, {token: true}).then(res => {
					if(res.code == 1){
						this.withdrawalList = res.data.map(item=>{
							return {
								time: item.create_time,
								desc: item.after,
								price: item.amount
							}
						})
					}
				})
			},
			handleTabs(index) {
				this.tabIndex = index
				if (this.tabIndex == 0) {
					this.elimit = 'spring'
				} else if (this.tabIndex == 1) {
					this.elimit = 'guoliang'
				} else {
					this.elimit = 'elimit'
				}
				this.getRecord()
			},
		}
	}
</script>

<style>
</style>